<!---
/*
 * @Description: 美妆镜partner
 * @Author: kanglin
 * @Date: 2018-10-09 08:45:16
 * @Copyright: Created by Panxsoft.
 */
 --->

<section class="partner" id="all-start-partner" >
    <div class="bym-wrapper">

        <div class="partner-content">
            <div class="swiper-container">
                <div class="swiper-wrapper">
                    <div class="swiper-slide">
                    <ul class="list bym-not-list">
                            <li class="list-item">
                                <div class="list-item-thumb">
                                    <img src="//gz.bcebos.com/v1/panx-website/images/home/partner/danyangyanjingcheng.jpg" alt="">
                                </div>
                                <span class="list-item-name">丹阳眼镜城</span>
                            </li>
                            <li class="list-item">
                                <div class="list-item-thumb">
                                    <img src="//gz.bcebos.com/v1/panx-website/images/home/partner/kangniate.jpg" alt="">
                                </div>
                                <span class="list-item-name">康耐特</span>
                            </li>
                            <li class="list-item">
                                <div class="list-item-thumb">
                                    <img src="//gz.bcebos.com/v1/panx-website/images/home/partner/levis.jpg" alt="">
                                </div>
                                <span class="list-item-name">李维斯</span>
                            </li>

                        </ul>
                    </div>
                    <div class="swiper-slide">
                        <ul class="list bym-not-list">
                           
                            <li class="list-item">
                                <div class="list-item-thumb">
                                    <img src="//gz.bcebos.com/v1/panx-website/images/home/partner/pirim.jpg" alt="">
                                </div>
                                <span class="list-item-name">派丽蒙</span>
                            </li>

                            <li class="list-item">
                                <div class="list-item-thumb">
                                    <img src="//gz.bcebos.com/v1/panx-website/images/home/partner/igs_home_img.png" alt="">
                                </div>
                                <span class="list-item-name">新加坡 IGS</span>
                            </li>
                        </ul>
                    </div>

                </div>
            </div>



            <!-- 箭头 begin -->
            <div class="partner-content-next">
                <img src="http://gz.bcebos.com/panx-website/images/home/partner/next.png" alt="next">
            </div>
            <div class="partner-content-prev">
                <img src="http://gz.bcebos.com/panx-website/images/home/partner/prev.png" alt="prev">
            </div>
            <!-- 箭头 end -->
        </div>

    </div>
</section>

<script>
     window.addEventListener('load', function(){
        
    var next = document.querySelector('#all-start-partner .partner-content-next');
    var prev = document.querySelector('#all-start-partner .partner-content-prev');
    var children = document.querySelector('#all-start-partner .swiper-wrapper').children;
    next.style.display = 'none';

    var swiper = new Swiper('#all-start-partner .swiper-container',{
        autoplay : 5000,//可选选项，自动滑动
        // loop : true,//可选选项，开启循环
        queueEndCallbacks : true,
        queueStartCallbacks : true,
        onSlideChangeEnd: changeEndHandle,
        simulateTouch: true
    });

    function changeEndHandle (swiper) {
        if ((swiper.activeIndex+1) === children.length) {
            prev.style.display = 'none';
        } else {
            prev.style.display = 'block';
        }

        if (swiper.activeIndex === 0) {
            next.style.display = 'none';
        } else {
            next.style.display = 'block';
        }
        
    }

    prev.addEventListener('click', function (event) {
        event.preventDefault();
        swiper.swipeNext();
        // alert(swiper.activeIndex)
    }, false);

    next.addEventListener('click', function (event) {
        event.preventDefault();
        swiper.swipePrev();
    }, false);

    });
</script>